@{
    ViewBag.Title = "在线英文字母大小写转换器工具-包含英文大写转小写-字母小写转大写";
    ViewBag.keywords = "大小写转换,大小写转换器,英文大小写转换,英文字母大小写转换,在线大小写转换";
    ViewBag.description = "在线英文字母大小写转换器工具，能很方便的将英文字母全部转换为大写或者小写，或者将英文句子转换成首字母大写";
}
<div class="panel panel-default">
    <blockquote class="layui-elem-quote"><h3>英文大小写转换|首字母大写转换</h3></blockquote>
    <div>提供大小写转换工具可以将大写字母全部转换成小写字母，也可以将小写字母全部转换为大写字母，还可以实现首字母大写转换。</div>
    <div class="layui-row">
        <div align="center">
            <textarea id="content" name="content" style="width:100%;" class="json_input top10" cols="18" rows="15"></textarea>
        </div>
        <input class="layui-btn layui-btn-primary" type="button" value="转换成大写" onclick="englishConvert('touppercase')">
        <input class="layui-btn layui-btn-primary" type="button" value="转换成小写" onclick="englishConvert('tolowercase')">
        <input class="layui-btn layui-btn-primary" type="button" value="首字母大写" onclick="englishConvert('touppercaseF')">
        <input class="layui-btn layui-btn-success" type="button" value="复制" onclick="content.select();document.execCommand(&quot;Copy&quot;)">
        <input class="layui-btn layui-btn-danger" type="button" value="清空" onclick="clearText('content')">
    </div>
    <input type="hidden" id="tabsize" value="1">
    <div class="panel-footer"></div>
</div>
@section Scripts{
<script>
    function getid(id) {
        return (typeof id == 'string') ? document.getElementById(id) : id
    };
    function TransConvert() {
        getid("trans").value = ToTrans(getid("num").value)
    }
    function ToTrans(a) {
        var b = 9.999999999999E10,
        f = "\u96f6",
        h = "\u58f9",
        g = "\u8d30",
        e = "\u53c1",
        k = "\u8086",
        p = "\u4f0d",
        q = "\u9646",
        r = "\u67d2",
        s = "\u634c",
        t = "\u7396",
        l = "\u62fe",
        d = "\u4f70",
        i = "\u4edf",
        m = "\u4e07",
        j = "\u4ebf",
        u = "人民币",
        o = "\u5143",
        c = "\u89d2",
        n = "\u5206",
        v = "\u6574";
        a = a.toString();
        if (a == "") {
            alert("转换内容不能为空!");
            return ""
        }
        if (a.match(/[^,.\d]/) != null) {
            alert("输入有误,请输入小数点和纯数字!");
            return ""
        }
        if (a.match(/^((\d{1,3}(,\d{3})*(.((\d{3},)*\d{1,3}))?)|(\d+(.\d+)?))$/) == null) {
            alert("输入有误,请输入小数点和纯数字!");
            return ""
        }
        a = a.replace(/,/g, "");
        a = a.replace(/^0+/, "");
        if (Number(a) > b) {
            alert("\u5bf9\u4e0d\u8d77,\u4f60\u8f93\u5165\u7684\u6570\u5b57\u592a\u5927\u4e86!\u6700\u5927\u6570\u5b57\u4e3a99999999999.99\uff01");
            return ""
        }
        b = a.split(".");
        if (b.length > 1) {
            a = b[0];
            b = b[1];
            b = b.substr(0, 2)
        } else {
            a = b[0];
            b = ""
        }
        h = new Array(f, h, g, e, k, p, q, r, s, t);
        l = new Array("", l, d, i);
        m = new Array("", m, j);
        n = new Array(c, n);
        c = "";
        if (Number(a) > 0) {
            for (d = j = 0; d < a.length; d++) {
                e = a.length - d - 1;
                i = a.substr(d, 1);
                g = e / 4;
                e = e % 4;
                if (i == "0") j++;
                else {
                    if (j > 0) c += h[0];
                    j = 0;
                    c += h[Number(i)] + l[e]
                }
                if (e == 0 && j < 4) c += m[g]
            }
            c += o
        }
        if (b != "") for (d = 0; d < b.length; d++) {
            i = b.substr(d, 1);
            if (i != "0") c += h[Number(i)] + n[d]
        }
        if (c == "") c = f + o;
        if (b.length < 2) c += v;
        return c;
    }

    function englishConvert(str) {
        var text = getid("content").value;
        if (text == "" || text == null) {
            alert("请输入要转换的内容");
            return;
        }
        if (str == "tolowercase") {
            getid("content").value = text.toLowerCase();
        }
        else if (str == "touppercase") {
            getid("content").value = text.toUpperCase();
        }
        else {
            getid("content").value = FirstLetterCase(text);
        }
    }

    function FirstLetterCase(str) {
        var index;
        var tmpStr;
        var tmpChar;
        var preString;
        var postString;
        var strlen;
        tmpStr = str.toLowerCase();
        strLen = tmpStr.length;
        if (strLen > 0) {
            for (index = 0; index < strLen; index++) {
                if (index == 0) {
                    tmpChar = tmpStr.substring(0, 1).toUpperCase();
                    postString = tmpStr.substring(1, strLen);
                    tmpStr = tmpChar + postString;
                }
                else {
                    tmpChar = tmpStr.substring(index, index + 1);
                    if (tmpChar == " " && index < (strLen - 1)) {
                        tmpChar = tmpStr.substring(index + 1, index + 2).toUpperCase();
                        preString = tmpStr.substring(0, index + 1);
                        postString = tmpStr.substring(index + 2, strLen);
                        tmpStr = preString + tmpChar + postString;
                    }
                }
            }
        }
        return tmpStr;
    }
    function copyText(str) {
        var text = getid(str).value;
        if (text == "" || text == null) {
            return;
        }
        if (window.clipboardData) {
            return (window.clipboardData.setData("Text", text));
        }
        else {
            if (window.netscape) {
                try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                    var clip = Components.classes["@@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
                    if (!clip) {
                        return;
                    }
                    var trans = Components.classes["@@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
                    if (!trans) {
                        return;
                    }
                    trans.addDataFlavor("text/unicode");
                    var str = new Object();
                    var len = new Object();
                    var str = Components.classes["@@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
                    var copytext = text;
                    str.data = copytext;
                    trans.setTransferData("text/unicode", str, copytext.length * 2);
                    var clipid = Components.interfaces.nsIClipboard;
                    if (!clip) {
                        return false;
                    }
                    clip.setData(trans, null, clipid.kGlobalClipboard);
                    return true;
                }
                catch (e) {
                    alert("您的firefox安全限制限制您进行剪贴板操作，请打开'about:config'将signed.applets.codebase_principal_support'设置为true'之后重试，相对路径为firefox根目录/greprefs/all.js");
                    return false;
                }
            }
        }
        return false;
    }

    function clearText(str) {
        getid(str).value = "";
    }


</script>
}